﻿namespace Note2._0
{
    public partial class NoteAdd : Form
    {
        public NoteAdd()
        {
            InitializeComponent();
        }

        public NoteAdd(string desc, string ip, string userName, string passWord, string dungeon)
        {
            InitializeComponent();
            this.bigDesc.Text = desc;
            this.bigIp.Text = ip;
            this.bigUserName.Text = userName;
            this.bigPassWord.Text = passWord;
        }

        private bool Check()
        {
            if (string.IsNullOrEmpty(bigDesc.Text))
            {
                MessageBox.Show("请输入备注");
                return false;
            }
            if (string.IsNullOrEmpty(bigIp.Text))
            {
                MessageBox.Show("请输入服务地址"); return false;
            }
            if (string.IsNullOrEmpty(bigUserName.Text))
            {
                MessageBox.Show("请输入账户"); return false;
            }
            if (string.IsNullOrEmpty(bigPassWord.Text))
            {
                MessageBox.Show("请输入密码"); return false;
            }
            return true;
        }

        private void airButton1_Click(object sender, EventArgs e)
        {
            if (Check())
            {
                SqlSugarHelper.AddOrUpdated(new Db.NoteRecord(bigIp.Text, bigUserName.Text, bigPassWord.Text, bigDesc.Text, "mstsc"));
                this.Close();
            }
        }
    }
}